<!DOCTYPE HTML>
<html  lang="zh" xmlns:th="http://www.thymeleaf.org">
<meta charset="utf-8">
<head th:include="include :: header"></head>
<link th:href="@{/ajax/libs/datapicker/datepicker3.css}" rel="stylesheet"/>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-vrsnAncCfgMgt-add">
			<!-- <div class="form-group">	
				<label class="col-sm-3 control-label">项目编号：</label>
				<div class="col-sm-8">
					<input id="prjId" name="prjId" class="form-control" type="text">
				</div>
			</div> -->
			<div class="form-group">	
				<label class="col-sm-3 control-label">项目名称：</label>
				<div class="col-sm-8">
					<select id="prjId" name="prjId" class="form-control m-b" th:with="type=${@prjinf.selectPrjInfAll()}">
	                    <option th:each="prjinf : ${type}" th:text="${prjinf.prjNm}" th:value="${prjinf.prjId}"></option>
	                </select>
				</div>
			</div>
			<!-- <div class="form-group">	
				<label class="col-sm-3 control-label">开发流编号：</label>
				<div class="col-sm-8">
					<input id="dvlpstrmId" name="dvlpstrmId" class="form-control" type="text">
				</div>
			</div> -->
			<div class="form-group">	
				<label class="col-sm-3 control-label">开发流名称：</label>
				<div class="col-sm-8">
					<select id="dvlpstrmId" name="dvlpstrmId" class="form-control m-b" th:with="type=${@devVersionContrlServiceImpl.selectDevStream()}">
						<option th:each="devVersionContrlServiceImpl : ${type}" th:text="${devVersionContrlServiceImpl.devStream}" th:value="${devVersionContrlServiceImpl.devVersionId}" ></option>
					</select>
				</div>
			</div>
			<div class="form-group">	
				<label class="col-sm-3 control-label">版本日期：</label>
				<div class="col-sm-8">
					<select id="vrsnDt" name="vrsnDt" class="form-control m-b" th:with="type=${@prjVrsnDtRel.selectPrjVrsnDtRelListAll()}">
	                    <option th:each="prjVrsnDtRel : ${type}" th:text="${prjVrsnDtRel.vrsnDt}" th:value="${prjVrsnDtRel.vrsnDt}"></option>
	                </select>
				</div>
			</div>
			<div class="form-group">	
				<label class="col-sm-3 control-label">发布方式：</label>
				<div class="col-sm-8">
					<select id="ancMod" name="ancMod" class="form-control m-b" th:with="type=${@dict.getType('anc_mod')}">
	                    <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
	                </select>
				</div>
			</div>
			<div class="form-group">	
				<label class="col-sm-3 control-label">发布模式：</label>
				<div class="col-sm-8">
					<select id="ancModeInd" name="ancModeInd" class="form-control m-b" th:with="type=${@dict.getType('anc_mode_ind')}">
	                    <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
	                </select>
				</div>
			</div>
			<div class="form-group">	
				<label class="col-sm-3 control-label">发布时点：</label>
				<div class="col-sm-8">
					<input id="ancTmpnt" name="ancTmpnt" class="form-control" type="text">
				</div>
			</div>
			<div class="form-group">	
				<label class="col-sm-3 control-label">开始时间：</label>
				<div class="col-sm-8">
					<div class="input-group date">
						<span class="input-group-addon"><i class="fa fa-calendar"></i></span>
						<input id="strPubSttm" name="strPubSttm" class="form-control" type="text">
					</div>
				</div>
			</div>
			<div class="form-group">	
				<label class="col-sm-3 control-label">结束时间：</label>
				<div class="col-sm-8">
					<div class="input-group date">
						<span class="input-group-addon"><i class="fa fa-calendar"></i></span>
						<input id="strPubEdtm" name="strPubEdtm" class="form-control" type="text">
					</div>
				</div>
			</div>
			<div class="form-group">	
				<label class="col-sm-3 control-label">更新脚本路径：</label>
				<div class="col-sm-8">
					<input id="udtscriptRte" name="udtscriptRte" class="form-control" type="text">
				</div>
			</div>
			<div class="form-group">	
				<label class="col-sm-3 control-label">比对脚本路径：</label>
				<div class="col-sm-8">
					<input id="cmpscriptRte" name="cmpscriptRte" class="form-control" type="text">
				</div>
			</div>
			<div class="form-group">	
				<label class="col-sm-3 control-label">本地视图路径：</label>
				<div class="col-sm-8">
					<input id="lclVwRte" name="lclVwRte" class="form-control" type="text">
				</div>
			</div>
			<div class="form-group">	
				<label class="col-sm-3 control-label">远程视图路径：</label>
				<div class="col-sm-8">
					<input id="rmtVwRte" name="rmtVwRte" class="form-control" type="text">
				</div>
			</div>
			<!-- <div class="form-group">	
				<label class="col-sm-3 control-label">最后更新日期时间：</label>
				<div class="col-sm-8">
					<input id="lastUdtDtTm" name="lastUdtDtTm" class="form-control" type="text">
				</div>
			</div> -->
		</form>
	</div>
    <div th:include="include::footer"></div>
    <script th:src="@{/js/jquery-ui-1.10.4.min.js}"></script>
	<script th:src="@{/ajax/libs/iCheck/icheck.min.js}"></script>
	<script th:src="@{/ajax/libs//datapicker/bootstrap-datepicker.js}"></script>
	<script th:src="@{/ajax/libs/beautifyhtml/beautifyhtml.js}"></script>
	<script>
       $(document).ready(function(){setup_draggable();$("#n-columns").on("change",function(){var v=$(this).val();if(v==="1"){var $col=$(".form-body .col-md-12").toggle(true);$(".form-body .col-md-6 .draggable").each(function(i,el){$(this).remove().appendTo($col)});$(".form-body .col-md-6").toggle(false)}else{var $col=$(".form-body .col-md-6").toggle(true);$(".form-body .col-md-12 .draggable").each(function(i,el){$(this).remove().appendTo(i%2?$col[1]:$col[0])});$(".form-body .col-md-12").toggle(false)}});$("#copy-to-clipboard").on("click",function(){var $copy=$(".form-body").clone().appendTo(document.body);$copy.find(".tools, :hidden").remove();$.each(["draggable","droppable","sortable","dropped","ui-sortable","ui-draggable","ui-droppable","form-body"],function(i,c){$copy.find("."+c).removeClass(c).removeAttr("style")});var html=html_beautify($copy.html());$copy.remove();$modal=get_modal(html).modal("show");$modal.find(".btn").remove();$modal.find(".modal-title").html("复制HTML代码");$modal.find(":input:first").select().focus();return false})});var setup_draggable=function(){$(".draggable").draggable({appendTo:"body",helper:"clone"});$(".droppable").droppable({accept:".draggable",helper:"clone",hoverClass:"droppable-active",drop:function(event,ui){$(".empty-form").remove();var $orig=$(ui.draggable);if(!$(ui.draggable).hasClass("dropped")){var $el=$orig.clone().addClass("dropped").css({"position":"static","left":null,"right":null}).appendTo(this);var id=$orig.find(":input").attr("id");if(id){id=id.split("-").slice(0,-1).join("-")+"-"+(parseInt(id.split("-").slice(-1)[0])+1);$orig.find(":input").attr("id",id);$orig.find("label").attr("for",id)}$('<p class="tools col-sm-12 col-sm-offset-3">						<a class="edit-link">编辑HTML<a> | 						<a class="remove-link">移除</a></p>').appendTo($el)}else{if($(this)[0]!=$orig.parent()[0]){var $el=$orig.clone().css({"position":"static","left":null,"right":null}).appendTo(this);$orig.remove()}}}}).sortable()};var get_modal=function(content){var modal=$('<div class="modal" style="overflow: auto;" tabindex="-1">	<div class="modal-dialog"><div class="modal-content"><div class="modal-header"><a type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</a><h4 class="modal-title">编辑HTML</h4></div><div class="modal-body ui-front">	<textarea class="form-control" 	style="min-height: 200px; margin-bottom: 10px;font-family: Monaco, Fixed">'+content+'</textarea><button class="btn btn-success">更新HTML</button></div>				</div></div></div>').appendTo(document.body);return modal};$(document).on("click",".edit-link",function(ev){var $el=$(this).parent().parent();var $el_copy=$el.clone();var $edit_btn=$el_copy.find(".edit-link").parent().remove();var $modal=get_modal(html_beautify($el_copy.html())).modal("show");$modal.find(":input:first").focus();$modal.find(".btn-success").click(function(ev2){var html=$modal.find("textarea").val();if(!html){$el.remove()}else{$el.html(html);$edit_btn.appendTo($el)}$modal.modal("hide");return false})});$(document).on("click",".remove-link",function(ev){$(this).parent().parent().remove()});
       $(".input-group.date").datepicker({todayBtn: "linked",keyboardNavigation: !1,forceParse: !1,calendarWeeks: !0,autoclose: !0});
   </script>
   
    <script type="text/javascript">
		var prefix = ctx + "rtms/vrsnAncCfgMgt"
		$("#form-vrsnAncCfgMgt-add").validate({
			rules:{
				prjNm:{
					required:true,
				},
				dvlpstrmNm:{
					required:true,
				},
				vrsnDt:{
					required:true,
				},
				ancMod:{
					required:true,
				},
				ancModeInd:{
					required:true,
				},
				ancTmpnt:{
					required:true,
				},
			}
		});
		
		function submitHandler() {
	        if ($.validate.form()) {
	            //$.operate.save(prefix + "/add", $('#form-vrsnAncCfgMgt-add').serialize());
	            add();
	        }
	    }
		
		function add() {
			var prjId = $("#prjId option:selected").val();
			var prjNm = $("#prjId option:selected").text();
			var dvlpstrmId = $("#dvlpstrmId option:selected").val();
			var dvlpstrmNm = $("#dvlpstrmId option:selected").text();
			var vrsnDt = $("#vrsnDt option:selected").val();
			var ancMod = $("#ancMod option:selected").val();
			var ancModeInd = $("#ancModeInd option:selected").val();
			var ancTmpnt = $("input[name='ancTmpnt']").val();
			var strPubSttm = $("input[name='strPubSttm']").val();
			var strPubEdtm = $("input[name='strPubEdtm']").val();
			var udtscriptRte = $("input[name='udtscriptRte']").val();
			var cmpscriptRte = $("input[name='cmpscriptRte']").val();
			var lclVwRte = $("input[name='lclVwRte']").val();
			var rmtVwRte = $("input[name='rmtVwRte']").val();
			$.ajax({
        		cache : true,
        		type : "POST",
        		url : ctx + "rtms/vrsnAncCfgMgt/add",
        		data : {
        			"prjId": prjId,
        			"prjNm": prjNm,
					"dvlpstrmId" : dvlpstrmId,
        			"dvlpstrmNm": dvlpstrmNm,
        			"vrsnDt": vrsnDt,
        			"ancMod": ancMod,
					"ancModeInd": ancModeInd,
        			"ancTmpnt": ancTmpnt,
        			"strPubSttm": strPubSttm,
        			"strPubEdtm": strPubEdtm,
        			"udtscriptRte": udtscriptRte,
        			"cmpscriptRte": cmpscriptRte,
        			"lclVwRte": lclVwRte,
        			"rmtVwRte": rmtVwRte
        		},
        		async : false,
        		error : function(request) {
        			$.modal.alertError("系统错误");
        		},
        		success : function(data) {
        			$.operate.saveSuccess(data);
        		}
        	});
		}
	</script>
</body>
</html>
